{% macro render_pager(pagination) %}
  <div class="am-cf">
    <div class="am-fr">
      <ul class="am-pagination tpl-pagination">
        <li {% if not pagination.has_prev %} class="am-disabled"{% endif %}>
          <a class="page-link" href="{{ url_for(request.endpoint, page=pagination.prev_num) }}">&laquo;</a>
        </li>
        {% for page in pagination.iter_pages() %}
            {% if page %}
                {% if page != pagination.page %}
                    <li>
                      <a href="{{ url_for(request.endpoint, page=page) }}">{{ page }}</a>
                    </li>
                {% else %}
                    <li class="am-active">
                        <a href="#">{{ page }}</a>
                    </li>
                {% endif %}
            {% elif ellipses != None %}
                <li class="am-disabled"><a class="page-link" href="#">&hellip;</a></li>
            {% endif %}
        {% endfor %}
        <li {% if not pagination.has_next %}class="am-disabled"{% endif %}>
          <a href="{{ url_for(request.endpoint, page=pagination.next_num) }}">&raquo;</a>
        </li>
      </ul>
    </div>
  </div>
{%- endmacro %}

{% macro render_front_pager(pagination, crawler_id) %}
    <nav class="d-flex justify-content-center wow fadeIn" style="visibility: visible; animation-name: fadeIn;">
        <ul class="pagination pg-blue">
            <li class="page-item{% if not pagination.has_prev %} disabled{% endif %}">
                <a class="page-link waves-effect waves-effect" href="{{ url_for(request.endpoint, page=pagination.prev_num, crawler_id=crawler_id) }}" aria-label="Previous">
                    <span aria-hidden="true">«</span>
                    <span class="sr-only">Previous</span>
                </a>
            </li>

        {% for page in pagination.iter_pages() %}
            {% if page %}
                {% if page != pagination.page %}
                    <li class="page-item">
                        <a class="page-link waves-effect waves-effect" href="{{ url_for(request.endpoint, page=page, crawler_id=crawler_id) }}">{{ page }}</a>
                    </li>
                {% else %}
                    <li class="page-item active">
                        <a class="page-link waves-effect waves-effect" href="#">{{ page }}
                            <span class="sr-only">(current)</span>
                        </a>
                    </li>
                {% endif %}
            {% elif ellipses != None %}
                <li class="page-item disabled"><a class="page-link" href="#">&hellip;</a></li>
            {% endif %}
        {% endfor %}
            <li class="page-item{% if not pagination.has_next %} disabled{% endif %}">
                <a class="page-link waves-effect waves-effect" href="{{ url_for(request.endpoint, page=pagination.next_num, crawler_id=crawler_id) }}" aria-label="Next">
                    <span aria-hidden="true">»</span>
                    <span class="sr-only">Next</span>
                </a>
            </li>
      </ul>
    </nav>
{%- endmacro %}
